Skip to content

feat(compass-indexes): Add view support to indexes tab COMPASS-9667 #7182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

DarshanaVenkatesh
Copy link
Collaborator

@DarshanaVenkatesh DarshanaVenkatesh commented Aug 8, 2025

Description

Change indexes tab to support views. Figma
COMPASS-9667

  • Views are supported on Compass for mongodb version 8.1+ and on Data Explorer for 8.0+.
  • We display banner to upgrade cluster and "no standard indexes" empty state for Compass <8.1 and Data Explorer <8.0
  • Banner's text changes slightly for Compass 8.0
  • We display banner linking to atlas indexes list and "no standard indexes" empty state for Data Explorer 8.0+
  • We display create search index and refresh buttons, indexes (disabled w/tooltip)/searchIndexes tabs and "no search indexes" empty state if Compass 8.1+ with no indexes
  • We display search index list if Compass 8.1+
compass_view_support_indexes.mov

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@DarshanaVenkatesh DarshanaVenkatesh marked this pull request as ready for review August 12, 2025 20:53
@Copilot Copilot AI review requested due to automatic review settings August 12, 2025 20:53
@DarshanaVenkatesh DarshanaVenkatesh requested a review from a team as a code owner August 12, 2025 20:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds view support to the indexes tab for MongoDB versions 8.0+ and 8.1+, enabling search index management on views with version-specific functionality. The implementation includes new banners, empty states, and conditional rendering based on MongoDB version and environment (Compass vs Data Explorer).

  • Introduces version-specific banners and empty states for views with different MongoDB versions
  • Adds conditional fetching and rendering of search indexes for readonly views
  • Updates the indexes toolbar to support view-specific functionality and disable standard indexes tab for views

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
atlas-upgrade-cluster-link.ts New utility function to generate Atlas cluster upgrade links
store.ts Updated search index fetching logic to support views on MongoDB 8.0+
search-indexes.ts Modified fetchIndexes to allow search index fetching for views on MongoDB 8.1+
view-version-incompatible-banners.tsx New component providing version-specific upgrade banners for views
indexes.tsx Updated main component to handle view support with conditional rendering and banners
indexes.spec.tsx Added test coverage for view support scenarios
indexes-toolbar.tsx Enhanced toolbar with view-specific controls and automatic tab selection
indexes-toolbar.spec.tsx Added tests for toolbar behavior with readonly views

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@mongodb-js mongodb-js deleted a comment from Copilot AI Aug 12, 2025
@DarshanaVenkatesh DarshanaVenkatesh changed the title COMPASS-9667: Add view support to indexes tab feat(compass-indexes): Add view support to indexes tab COMPASS-9667 Aug 12, 2025
@github-actions github-actions bot added the feat label Aug 12, 2025
@DarshanaVenkatesh DarshanaVenkatesh added the no release notes Fix or feature not for release notes label Aug 12, 2025
Comment on lines +109 to +111
const mongoDBMajorVersion = parseFloat(
serverVersion.split('.').slice(0, 2).join('.')
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use semver package for handling mongodb version comparison, you can't really rely fully on the version here being fully parseable as a number (because it's not). There are some examples in the code here that already use semver for similar checks (see serverSupportsSearchIndexManagement for example), please update your code to the similar pattern

Comment on lines +126 to +131
useEffect(() => {
// If the view is readonly, set the default tab to 'search-indexes'
if (isReadonlyView && indexView !== 'search-indexes') {
onIndexViewChanged('search-indexes'); // Update redux state
}
}, [indexView, isReadonlyView, onIndexViewChanged]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redux store owns this state and redux store reducer controls how exactly this state is set, this shouldn't be an effect in the view, please move this logic to the store

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat no release notes Fix or feature not for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants